<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<%@ include file="/common/include/page.jsp" %>
<!DOCTYPE html>
<html lang="en">
	<head>
		<title>列表 - easyui</title>
		<%@ include file="/common/include/title.jsp" %>
		<script src="${rootPath }/common/resource/hightchars/highcharts.js"></script>
		<script src="${rootPath }/common/resource/hightchars/modules/exporting.js"></script>
	</head>
	<body>
		<div id="container" class="easyui-panel" title="报表" data-options="collapsible:true,collapsed:true">
		</div>
		<!-- 测试数据 -->
		<table id="dataGrid" class="easyui-datagrid" title="测试数据"
			data-options="
			<%-- url:'${rootPath }/easyui/datagrid.json', --%>
			url:'${rootPath }/back/stat/goodsListJSON.html',
			method:'post',
			border:false,
			singleSelect:true,
			fit:true,
			fitColumn:true,
			collapsible:true,
			rownumbers:true,
			pagination:true,
			toolbar:'#gridToolsbar'">
			<thead>
				<tr>
					<th data-options="field:'createTime'">日期</th>
					<th data-options="field:'totalCount'">总数量</th>
					<th data-options="field:'maxPrice'">最大价格</th>
				</tr>
			</thead>
		</table>
		<!-- 表格的工具栏 -->
		<div id="gridToolsbar">
			<div>
				<input class="easyui-textbox" name="keyword" id="keyword" placeholder="请输入关键字">
				<select class="easyui-combobox" name="status" id="status">
					<option value="">请选择</option>
					<option value="1">启用</option>
					<option value="0">禁用</option>
				</select>
				<input class="easyui-datetimebox" placeholder="请输入起始时间" data-options="" name="st" id="st">
				-->
				<input class="easyui-datetimebox" placeholder="请输入结束时间" data-options="" name="ed" id="ed">
				<a href="" class="easyui-linkbutton" data-options="iconCls:'icon-search'" plain="true" onclick="return query()">搜索</a>
			</div>
			<div>
				<a href="#" class="easyui-linkbutton" title="添加" data-options="iconCls:'icon-add'"  plain="true" onclick="return addData()">添加</a>
				<a href="#" class="easyui-linkbutton" title="更新" data-options="iconCls:'icon-edit'" plain="true" onclick="return addData()">更新</a>
				<a href="#" class="easyui-linkbutton" title="删除" data-options="iconCls:'icon-remove'" plain="true" onclick="return removeData()">删除</a>
				<a href="${rootPath }/back/stat/goodsList.html?operType=downloadfile" class="easyui-linkbutton" title="下载" data-options="iconCls:'icon-remove'" plain="true">下载</a>
			</div>
		</div>
	</body>
</html>
<!-- 一定要将数据放到下面 -->
<script type="text/javascript">
	/* $(function()
	{
		$("#dataGrid").datagrid({
			onLoadSuccess:function()
			{
				成功加载完以后再触发 
				alert("====${requestScope.list}");
			}
		});
	}); */
	/* 参数1:指的就是将报表存储到哪个元素里面;元素的id */
	Highcharts.chart('container', {
	    chart: {
	        type: 'line'
	    },
	    title: {
	        text: '商品按天统计'
	    },
	    subtitle: {
	        text: '作者:我们的团队'
	    },
	    xAxis: {
	        categories: [
	        	<%-- list中放的是Map --%>
	        	<c:forEach items="${requestScope.list}" var="map" varStatus="stat">
	        		'${map.createTime}'
	        		<%-- 只要不是最后一个,都加上, --%>
	        		<c:if test="${!stat.last}">
		        		, 
	        		</c:if>
	        	</c:forEach>
	        	/* 'Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec' */
	        ]
	    },
	    yAxis: {
	        title: {
	            text: '数量/价格'
	        }
	    },
	    plotOptions: {
	        line: {
	            dataLabels: {
	                enabled: true
	            },
	            enableMouseTracking: false
	        }
	    },
	    series: [{
	        name: '总数量',
	        data: [
	        	<%-- list中放的是Map --%>
	        	<c:forEach items="${requestScope.list}" var="map" varStatus="stat">
	        		${map.totalCount}
	        		<%-- 只要不是最后一个,都加上, --%>
	        		<c:if test="${!stat.last}">
		        		, 
	        		</c:if>
	        	</c:forEach>
	        	/* 7.0, 6.9, 9.5, 14.5, 18.4, 21.5, 25.2, 26.5, 23.3, 18.3, 13.9, 9.6 */
	        ]
	    }, {
	        name: '最高价格',
	        data: [
	        	<%-- list中放的是Map --%>
	        	<c:forEach items="${requestScope.list}" var="map" varStatus="stat">
	        		${map.maxPrice}
	        		<%-- 只要不是最后一个,都加上, --%>
	        		<c:if test="${!stat.last}">
		        		, 
	        		</c:if>
	        	</c:forEach>
	        	/* 3.9, 4.2, 5.7, 8.5, 11.9, 15.2, 17.0, 16.6, 14.2, 10.3, 6.6, 4.8 */
	        ]
	    }]
	});
</script>